home *** CD-ROM | disk | FTP | other *** search
- // purpose: creates a database of levels for eCross
-
- import waba.io.*;
- import waba.ui.*;
-
- public class LevelsMaker extends MainWindow
- {
- // the creator ID of the software
- private static final String CREATOR_ID = "eCrs";
- // levels array
- private static final byte[][] LEVELS =
- {%TEMPLATE%
- };
-
- // creates a new catalog
-
- public void onStart()
- {
- Catalog c = new Catalog("eCross Levels." + CREATOR_ID + ".eCrs", Catalog.READ_ONLY);
- if (c.isOpen())
- c.delete();
-
- c = new Catalog("eCross Levels." + CREATOR_ID + ".eCrs", Catalog.CREATE);
- if (!c.isOpen())
- return;
-
- for (int i = 0; i < LEVELS.length; i++)
- {
- int len = LEVELS[i].length;
- if (c.addRecord(len + 2) == -1)
- return;
-
- // level
- if (c.writeBytes(LEVELS[i], 0, len) != len)
- return;
- }
-
- c.close();
- exit(0);
- }
- }
-
- // End of LevelsMaker.java
-